<html>
<body>
	<h1>REST api for simple CRUD-operations</h1>

    <h2>Input/output</h2>
    <p>Mime type - application/json</p>

    <h3>Object - Goods entity</h3>
    <p>
        <ul>id - Identity</ul>
        <ul>title - Name of goods</ul>
        <ul>price - Current price of goods</ul>
    </p>
    <h3>Object - ErrorInfo</h3>
    <p>
        <ul>url - request's url</ul>
        <ul>ex - Error description</ul>
    </p>

    <h2>Operations</h2>
    <h3>CREATE</h3>
    <p><a href="api/v1/goods" target="_blank">/api/v1/goods</a> - create new Goods entity</p>
    <p>HTTP Method - <b>PUT</b></p>
    <p>Input: JSON Goods, internal id does not matter</p>
    <p>Output: created Goods (JSON) or ErrorInfo(JSON)</p>
    <p>Return http codes:
        <ul>201 - ok, entity created</ul>
        <ul>400 - error, input entity is not valid</ul>
        <ul>503 - error, creation failure</ul>
        <ul>500 - Internal server error</ul>
    </p>
    <h3>FIND ALL</h3>
    <p><a href="api/v1/goods" target="_blank">/api/v1/goods[&page=NN][&length=LL]</a> - get all Goods entities</p>
    <p>HTTP Method - <b>GET</b></p>
    <p>Input: nothing</p>
    <p>Additional parameters:
        <ul>NN - Number of page.  Default is 0</ul>
        <ul>LL - Length of page. Default is 100</ul>
    </p>
    <p>Output: list of Goods (JSON) or ErrorInfo(JSON)</p>
    <p>Return http codes:
    <ul>302 - ok, entities found, no more pages</ul>
    <ul>206 - ok, entities found, but more pages exist</ul>
    <ul>404 - Entities not found</ul>
    <ul>500 - Internal server error</ul>
    </p>

    <h3>FIND</h3>
    <p><a href="api/v1/goods/1" target="_blank">/api/v1/goods/{id}</a> - get Goods by given <b>id</b></p>
    <p>HTTP Method - <b>GET</b></p>
    <p>Input: nothing</p>
    <p>Output: Goods entity (JSON) or ErrorInfo(JSON)</p>
    <p>Return http codes:
    <ul>302 - ok, entities found</ul>
    <ul>404 - Entities not found</ul>
    <ul>500 - Internal server error</ul>
    </p>

    <h3>UPDATE</h3>
    <p><a href="api/v1/goods/1" target="_blank">/api/v1/goods/{id}</a> - update Goods entity by given <b>id</b></p>
    <p>HTTP Method - <b>POST</b></p>
    <p>Input: JSON Goods, internal id does not matter</p>
    <p>Output: nothing or ErrorInfo(JSON)</p>
    <p>Return http codes:
    <ul>200 - ok, entity updated</ul>
    <ul>400 - error, input entity is not valid</ul>
    <ul>503 - error, update failure</ul>
    <ul>500 - Internal server error</ul>
    </p>
    <h3>DELETE</h3>
    <p><a href="api/v1/goods/1" target="_blank">/api/v1/goods/{id}</a> - delete Goods entity by given <b>id</b></p>
    <p>HTTP Method - <b>DELETE</b></p>
    <p>Input: nothing</p>
    <p>Output: nothing or ErrorInfo(JSON)</p>
    <p>Return http codes:
    <ul>200 - ok, entity updated</ul>
    <ul>503 - error, delete failure</ul>
    <ul>500 - Internal server error</ul>
    </p>
</body>
</html>